Lseek, Open and Fcntl Flags

lseek()

#include unistd.h>

DefineValueMeaning


SEEK_SET0from beginning of file SEEK_CUR1from current location SEEK_END2from end of file


open()

#include fcntl.h>

DefineValueMeaning


O_RDONLY0x00read only O_WRONLY0x01write only O_RDWR0x02read/write O_NDELAY0x04non-blocking I/O O_SYNC0x08sync after writes (MiNT) O_APPEND0x10position at EOF O_CREAT0x20create new file if needed O_TRUNC0x40make file 0 length O_EXCL0x80error, if file exists


access()

#include fcntl.h>

DefineValueMeaning


F_OK0present X_OK1executable W_OK2writable R_OK4readable


fcntl()

#include fcntl.h>

DefineValueMeaning


F_DUPFD0Duplicate fildes (MiNT) F_GETFD1Get fildes flags (MiNT) F_SETFD2Set fildes flags (MiNT) F_GETFL3Get file flags (MiNT) F_SETFL4Set file flags (MiNT) F_GETLK5Get file lock (MiNT) F_SETLK6Set file lock (MiNT)

Locking under MiNT currently only works for FIFOs.

struct flock short l_type;type of lock long l_start;start of locked reg. long l_len;0 for rest of file short l_pid;set by F_GETLK

DefineValueMeaning


F_RDLCKO_RDONLYRead lock (MiNT) F_WRLCKO_WRONLYWrite lock (MiNT) F_UNLCK3Unlock (MiNT)